/**
 * Created by Administrator on 2016-04-19.
 */
var dgram = require('dgram');


function Client() {
    this._sockets=[];
}

Client.prototype.start=function () {
    var soc= dgram.createSocket("udp4");
    soc.on("message", function (msg, rinfo) {
        console.log(msg.toString());
        console.log(rinfo);
    });
    soc.bind(30011);
    this._sockets.push(soc);
};
Client.prototype.close=function () {
    this._sockets[0].close();
};

Client.prototype.send=function () {
    var client=this._sockets[0];

    var message = new Buffer("Some bytes");
    // console.log('send');
    client.send(message, 0, message.length, 41234, "115.159.52.62");
    // client.send(message, 0, message.length, 5115, "58.19.1.136");


};

//80        4166
//30011   5081



module.exports=Client;
